{if ($type=='template')}
    <div class="row">
        {volist name="data" id="v"}
        <div class="col-sm-6 col-md-4 col-lg-4 col-xl-3">
            <div class="card">
                {if isset($site[$module.'_theme']) && $site[$module.'_theme']==$v['name']}
                <div class="ribbon-wrapper">
                    <div class="ribbon bg-success">{:lang("Current topic")}</div>
                </div>
                {/if}
                <div class="img-thumb">
                    <a href="{if isset($info[$v['name']]['url'])}{$info[$v['name']]['url']}{else /}{$v['website']|default=''}{/if}" target="_blank" title="{:lang('Template description link')}">
                        <img src="{$v.image|default=''}" class="card-img-top">
                    </a>
                </div>
                <div class="card-body">
                    <h5 class="card-title" title="{$v.title}" data-toggle="tooltip">{$v.title}</h5>
                    <p class="card-text text-sm" title="{$v.description}" data-toggle="tooltip">{$v.description}</p>
                    <div class="d-flex justify-content-between align-items-center">
                        <div class="footer-fa">
                            {if !isset($v['db_install'])}
                                <div class="btn-group">
                                    {if !(isset($site[$module.'_theme']) && $site[$module.'_theme']==$v['name'])}
                                    <a href="{:url('/Appcenter/setTheme',['name'=>$v['name'],'module'=>$module])}" class="btn btn-primary btn-xs" data-name="{$v['name']}">{:lang("Set as theme")}</a>
                                    {else /}
                                        {if $v['config']}
                                        <a class="btn btn-primary btn-xs" href="javascript:cmsOpen('{:url('/appcenter/setConfig',['name'=>$v['name'],'type'=>'template','popup'=>1,'module'=>$module])}')">{:lang("Config")}</a>
                                        {else /}
                                        <a href="{:url('/appcenter/pack',['type'=>'template','module'=>$module,'name'=>$v['name']])}" class="btn btn-primary btn-xs btn-export">{:lang('Export')}</a>
                                        {/if}
                                    {/if}

                                    {if !(isset($site[$module.'_theme']) && $site[$module.'_theme']==$v['name'])}
                                        <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split btn-xs" data-toggle="dropdown" aria-expanded="false" title="{:lang('More actions')}">
                                            <span class="sr-only">Toggle Dropdown</span>
                                        </button>
                                        <div class="dropdown-menu">
                                            <a href="{:url('/appcenter/pack',['type'=>'template','module'=>$module,'name'=>$v['name']])}" class="dropdown-item"><i class="fa fa-file-export"></i> {:lang('Export')}</a>
                                            {if $v['config']}
                                            <a class="dropdown-item" href="javascript:cmsOpen('{:url('/appcenter/setConfig',['name'=>$v['name'],'type'=>'template','popup'=>1,'module'=>$module])}')"><i class="fas fa-cogs"></i> {:lang("Config")}</a>
                                            {/if}
                                            <div class="dropdown-divider"></div>
                                            <a href="#" class="dropdown-item btn-uninstall" data-type="template" data-module="{$module}" data-name="{$v['name']}" title="{:lang("Uninstall")}"><i class="fas fa-trash-alt"></i> {:lang("Uninstall")}</a>
                                        </div>
                                    {else /}
                                        {if $v['config']}
                                        <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split btn-xs" data-toggle="dropdown" aria-expanded="false" title="{:lang('More actions')}">
                                            <span class="sr-only">Toggle Dropdown</span>
                                        </button>
                                        <div class="dropdown-menu">
                                            <a href="{:url('/appcenter/pack',['type'=>'template','module'=>$module,'name'=>$v['name']])}" class="dropdown-item"><i class="fa fa-file-export"></i> {:lang('Export')}</a>
                                        </div>
                                        {else /}

                                        {/if}
                                    {/if}
                                </div>
                            {else /}
                            <a href="#" class="btn btn-primary btn-xs btn-install-db" data-name="{$v.name}" data-type="template" data-module="{$module}">{:lang('Install')}</a>
                            {/if}
                        </div>
                        <div class="footer-fa">
                            <span><i class="fas fa-user-alt"></i> {$v.author}</span>

                            {if isset($info) && $info!==false}
                                <?php $version_info = isset($info[$v['name']]['version_info'])?$info[$v['name']]['version_info']:'';?>
                                <?php $upgradeData = get_upgrade($v['version'], $version_info);?>
                                {if !empty($version_info) && $upgradeData!==false}
                                <a href="#" class="btn-upgrade text-primary" data-name="{$v['name']}" title="{:lang('Update to')}{$upgradeData[0]}" data-trigger="hover" data-toggle="tooltip">{$v.version}</a>
                                {if count($upgradeData)>1}
                                <span class="dropdown-toggle" title="{:lang('Update the specified version')}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
                                <div class="dropdown-menu">
                                    {volist name="upgradeData" id="vv"}
                                    <a class="dropdown-item btn-upgrade" href="#" data-name="{$v['name']}" data-version="{$vv}">{$vv}</a>
                                    {/volist}
                                </div>
                                {/if}
                                {else /}
                                <span><i class="fas fa-info-circle"></i> {$v.version}</span>
                                {/if}
                            {else /}
                            <span class="text-danger" title="{:lang('Failed to check update, failed to connect to update server!')}" data-trigger="hover" data-toggle="tooltip"><i class="fas fa-info-circle"></i> {$v.version}</span>
                            {/if}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {/volist}
    </div>
{else /}
<table class="table table-bordered table-hover table-striped">
    <thead>
        <tr>
            <th>
                <div class="th-inner ">{:lang("Serial number")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:lang("Name")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:lang("Introduce")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:lang("Author")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:lang("Price")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:lang("Version")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:lang("Status")}</div>
                <div class="fht-cell"></div>
            </th>
            <th>
                <div class="th-inner ">{:lang("Operate")}</div>
                <div class="fht-cell"></div>
            </th>
        </tr>
    </thead>
    <tbody>
    {volist name="data" id="v"}
    <tr>
        <td>{$i}</td>
        <td><a href="{if isset($info[$v['name']]['url'])}{$info[$v['name']]['url']}{else /}#{/if}" class="text-primary" target="_blank">{$v.title|default=''}</a></td>
        <td>{$v.description|default=''}</td>
        <td>{$v.author|default=''}</td>
        <td>{:isset($v['price'])?$v['price']<=0?'<span class="text-primary">'.lang("Free").'</span>':'<span class="text-danger">'.$v['price'].'</span>':'-'}</td>
        <td>
            {if isset($info) && $info===false}
            <span class="text-danger" title="{:lang('Failed to check update, failed to connect to update server!')}" data-trigger="hover" data-toggle="tooltip">{$v.version|default=''}</span>
            {else /}
            {$v.version|default=''}
            {/if}
        </td>
        <td>
            {if !isset($v['db_install'])}
            <div class="custom-control custom-switch custom-switch-on-teal" data-toggle="tooltip" data-trigger="hover" data-placement="top" title="{:lang("Click to switch")}">
            <input type="checkbox" class="custom-control-input" data-name="{$v.name|default=''}" id="customSwitch{$v.name}" {$v.status==1?'checked':''} value="{$v.status}">
            <label class="custom-control-label" for="customSwitch{$v.name}"></label>
            </div>
            {/if}
        </td>
        <td>
            {if !isset($v['db_install'])}
                {if isset($v['config'])&&$v['config']&&$v['status']==1}
                <a href="javascript:cmsOpen('{:url('/appcenter/setConfig',['name'=>$v['name'],'type'=>$v['type'],'popup'=>1])}')" class="btn btn-primary btn-xs"><i class="fas fa-cogs"></i>
                    {:lang("Config")}</a>
                {/if}
                <a href="#" class="btn btn-danger btn-xs btn-uninstall" data-name="{$v.name}" data-type="{$v['type']}"><i class="fas fa-trash-alt"></i>
                    {:lang("Uninstall")}</a>&nbsp;
                <a href="{:url('/appcenter/pack',['type'=>$v['type'],'name'=>$v['name']])}" target="_blank" class="btn btn-primary btn-xs"><i class="fas fa-file-archive"></i>
                    {:lang("Pack")}</a>

                <!--更新-->
                {if isset($info) && $info!==false}
                    <?php $version_info = isset($info[$v['name']]['version_info'])?$info[$v['name']]['version_info']:'';?>
                    <?php $upgradeData = get_upgrade($v['version'], $version_info);?>
                    {if !empty($version_info) && $upgradeData!==false}
                    <div class="btn-group btn-group-xs" role="group" aria-label="Basic example">
                        <a href="#" class="btn btn-primary btn-upgrade btn-xs" data-name="{$v['name']}" title="{:lang('Update to')}{$upgradeData[0]}" data-trigger="hover" data-toggle="tooltip">{:lang("Update")}</a>
                        {if count($upgradeData)>1}
                        <button type="button" class="btn btn-primary dropdown-toggle btn-xs" title="{:lang('Update the specified version')}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
                        <div class="dropdown-menu">
                            {volist name="upgradeData" id="vv"}
                            <a class="dropdown-item btn-upgrade" href="#" data-name="{$v['name']}" data-version="{$vv}">{$vv}</a>
                            {/volist}
                        </div>
                        {/if}
                    </div>
                    {/if}
                {/if}
            {else /}
            <a href="#" class="btn btn-primary btn-xs btn-install-db" data-name="{$v.name}" data-type="{$v['type']}">{:lang('Install')}</a>
            {/if}
        </td>
    </tr>
    {/volist}
    {if empty($data)}
    <tr><td colspan="8">{:lang("No data")}</td></tr>
    {/if}
    </tbody>
</table>
{/if}